<template>
  <div class="questionView">
    <p class="questionLabel">{{question.title}}</p>
    <div v-for="(el, idx) in question.questions">
      <question-item-m :question="el" :answer="mixAnswer[el.id]" :examType="examType" :mix="1" @sendOptionClick="optionClick"></question-item-m>
    </div>

  </div>
</template>

<script>

  import QuestionItemM from './QuestionItemM'

  export default {
    name: 'MixQuestionPc',
    props: {
      question: {
        default () {
          return {}
        }
      },
      mixAnswer: {
        default () {
          return {}
        }
      },
      examType: {
        default () {
          return 1
        }
      },
    },
    components: {
      QuestionItemM,
    },
    data() {
      return {
      }
    },
    methods: {
      //题目选项点击
      optionClick(question, answer) {
        let answerData = {...this.mixAnswer}
        if (Object.keys(answer).length === 0) {
          delete answerData[question.id]
        } else {
          answerData[question.id] = answer
        }
        this.$emit('sendOptionClick', this.question, answerData);

      },
    }
  }
</script>

<style scoped>
  .questionLabel {
    padding: 0 16px 16px 16px;
    font-size: 14px;
    font-weight: bold;
    color: #333333;
  }

</style>
